/**
 * Copyright 2009 Sergio Bossa
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package com.googlecode.actorom;

import java.io.Serializable;

/**
 * Special purpose message object, sent by killed or failed actors to linked ones prior to actually exiting.<br>
 * Linked actors receiving this message may trap it (see {@link com.googlecode.actorom.annotation.TrapExit}), or die by
 * killing themselves.
 *
 * @author Sergio Bossa
 */
public class ExitActorMessage implements Serializable {

    private static final long serialVersionUID = 12345678901L;

    private final Address sender;
    private final ExitReason reason;

    /**
     * Create the message.
     *
     * @param sender The address of the killed or failed actors which sent the message.
     * @param reason The exit reason: killed or failed.
     */
    public ExitActorMessage(Address sender, ExitReason reason) {
        this.sender = sender;
        this.reason = reason;
    }

    /**
     * Get the address of the killed or failed actors which sent this message.
     * @return
     */
    public Address getSender() {
        return sender;
    }

    /**
     * Get the exit reason.
     * @return
     */
    public ExitReason getReason() {
        return reason;
    }
}
